import javax.swing.plaf.synth.SynthEditorPaneUI;

/**
 * Created by LJY on 2017/3/12.
 */
import java.util.Scanner;
class CashCard {
    private String number;
    private int balance;
    private int bonus;
    CashCard(String number,int balance,int bonus){
        this.number=number;
        this.balance=balance;
        this.bonus=bonus;
    }
    void store(int money){
        if (money>0){
            this.balance+=money;
            if(money>=1000){
                this.bonus++;
            }
        }
        else{
            System.out.println("储值为负？");
        }
    }
    int getBalance(){
        return balance;
    }
    int getBonus(){
        return bonus;
    }
    String getNumber(){
        return number;
    }

    public static void main(String[] args) {
        CashCard[] cards={
                new CashCard("A001",500,0),
                new CashCard("A002",300,0),
                new CashCard("A003",1000,1)
        };
        Scanner scanner=new Scanner(System.in);
        for(CashCard card:cards){
            System.out.printf("为（%s,%d,%d）储值：%n",card.getNumber(),card.getBalance(),card.getBonus());
            card.store(scanner.nextInt());
            System.out.printf("明细（%s,%d,%d）%n",card.getNumber(),card.getBalance(),card.getBonus());
;        }
    }

}
